<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.4"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Flow: flow::util::bind_ns Namespace Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">Flow<span id="projectnumber">&#160;2.0.0</span>
   </div>
   <div id="projectbrief">Flow project: Full implementation reference.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.4 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespaceflow.html">flow</a></li><li class="navelem"><a class="el" href="namespaceflow_1_1util.html">util</a></li><li class="navelem"><a class="el" href="namespaceflow_1_1util_1_1bind__ns.html">bind_ns</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle"><div class="title">flow::util::bind_ns Namespace Reference</div></div>
</div><!--header-->
<div class="contents">

<p>Hack namespace alias to enable use of <code>bind</code> and related utilities like <code>cref</code> in the face of strange observed compiler behavior.  
<a href="namespaceflow_1_1util_1_1bind__ns.html#details">More...</a></p>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p >Hack namespace alias to enable use of <code>bind</code> and related utilities like <code>cref</code> in the face of strange observed compiler behavior. </p>
<p >The code in the past used <code>bind</code> and its helpers <code>cref</code> and <code>ref</code> fairly extensively. (Vast majority of <code>bind</code>s are now replaced with superior uses of lambdas, with the upgrade to C++1x. So it's far less extensive than in past.) However, there is something odd going on with namespace resolution for these guys. At least in the clang version used as of this writing, <code>bind</code> somehow works without qualification, as does <code>cref</code> (and thus probably <code>ref</code>); I really don't know why. I'd like to use the <code>boost::</code> versions, though, specifically (for stylistic reasons explained elsewhere). More importantly, I don't want to use something that mysteriously works without qualification &ndash; is <code>std::</code> somehow being forced with some phantom <code>using namespace</code> from some evil header somewhere? I am not sure as of this writing. In any case, this allows one to just say <code>using util::bind_ns::bind</code> and then use <code>bind()</code> without qualification in that block (typically function/method) without worrying that some weird unqualified guy will be used.</p>
<p >Caveat 1: I don't know why, but in the aforementioned clang, <code>using util::bind_ns::cref</code> makes <code>cref()</code> become ambiguous with some <code>std::cref</code>; it's quite unclear why the same complaint then doesn't happen for <code>bind()</code> itself. In that case, when an error is encountered, get rid of the <code>using</code> and instead qualify it as <code>util::bind_ns::cref()</code>. It sucks, but at least it's clear.</p>
<p >Caveat 2: I haven't built in MS Visual Studio in quite a while (though it did use to work at one point), but back then I remember some VC++-specific trouble with <code>bind()</code> resolution. Possibly it's related to the above. Anyway, use <code><a class="el" href="namespaceflow_1_1util_1_1bind__ns.html" title="Hack namespace alias to enable use of bind and related utilities like cref in the face of strange obs...">bind_ns</a></code> as needed to get around any such compile errors.</p>
<p >Note: Knowing of this phantom <code>bind()</code> that's magically available sans qualification, I also tried to use unqualified <code>cout</code> and <code>endl</code> in the same context but thankfully got the expected errors in clang saying these identifiers do not exist but suggesting the use of <code>std::cout</code> and <code>std::endl</code>. So, at least it's not all of <code>std</code> being forced on the code.</p>
<dl class="todo"><dt><b><a class="el" href="todo.html#_todo000149">Todo:</a></b></dt><dd>Investigate deeply the cause of the strange behavior with unqualified <code>bind()</code> and others described above this line in the source code. </dd></dl>
</div></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri Mar 28 2025 22:55:36 for Flow by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.4
</small></address>
</body>
</html>
